<template>
  <div class="contain">
    <img src="../assets/images/logo.png" class="imgpost" alt="" />
    <img src="../assets/images/index2.png" class="imgsize" alt="" />
    <div class="flex-colum box">
      <div class="title">
        <p>欢迎来到预约平台！</p>
        <p>点击下方按钮，快去预约吧！</p>
      </div>
      <div class="btn colos3" @click="goShool()">基地介绍</div>
      <div class="btn colos2" @click="goReserve()">参观预约</div>
      <div class="btn colos1" @click="goHistory()">查询和修改</div>
    </div>
    <div class="tips">科研处联系电话:0731-22777610</div>
  </div>
</template>
<script>
import { mapState } from "vuex";
import { Dialog } from "vant";
export default {
  data() {
    return {};
  },
  components: {},
  computed: {
    ...mapState("user", ["userInfo"]),
  },
  mounted() {},
  methods: {
    isLogin() {
      Dialog.confirm({
        title: "温馨提示",
        message: "请登录使用完整服务",
        confirmButtonText: "去登陆",
        cancelButtonText: "稍后登录",
        confirmButtonColor: "#0065ff",
      })
        .then(() => {
          this.$go("/login");
        })
        .catch(() => {});
    },
    goShool() {
      this.$go("/school");
    },
    goReserve() {
      if (
        Object.keys(this.userInfo).length !== 0 &&
        this.userInfo !== "" &&
        this.userInfo !== undefined
      ) {
        this.$go("/reserve");
      } else {
        this.isLogin();
      }
    },
    goHistory() {
      if (
        Object.keys(this.userInfo).length !== 0 &&
        this.userInfo !== "" &&
        this.userInfo !== undefined
      ) {
        this.$go("/history");
      } else {
        this.isLogin();
      }
    },
  },
  beforeDestroy() {},
};
</script>

<style lang="less" scoped>
.contain {
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
}
.imgpost {
  width: 80%;
  position: absolute;
  top: 20px;
}
.imgsize {
  width: 100%;
  height: 100%;
}
.title {
  color: #ffffff;
  font-size: 18px;
  font-weight: bold;
  width: 88%;
  text-align: left;
  line-height: 30px;
  margin-left: 10px;
  margin-bottom: 20px;
}
.box {
  width: 100%;
  align-items: center;
  margin-top: -70px;
  .btn {
    width: 88%;
    padding: 20px 0;
    text-align: center;
    font-weight: bold;
    border-radius: 15px;
    font-size: 18px;
  }
  .colos1 {
    margin-top: 18px;
    color: #fff;
    background-color: rgb(253, 189, 81);
    box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
  }
  .colos2 {
    margin-top: 18px;
    background-color: rgb(90, 148, 243);
    color: rgb(255, 255, 255);
    box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
  }
  .colos3 {
    margin-top: 30px;
    background-color: #67c23a;
    color: rgb(255, 255, 255);
    box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
  }
}
.tips {
  width: 100%;
  text-align: center;
  margin: 20px 0;
  font-size: 16px;
  font-weight: 600;
  color: #999999;
}
</style>
